package io.gitee.bluemiaomiao.dataanalyzebackend.service.impl;


import io.gitee.bluemiaomiao.dataanalyzebackend.domian.RuserRole;
import io.gitee.bluemiaomiao.dataanalyzebackend.repos.RuserRoleDao;
import io.gitee.bluemiaomiao.dataanalyzebackend.service.RuserRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (RuserRole)表服务实现类
 *
 * @author makejava
 * @since 2020-11-07 16:09:30
 */
@Service("ruserRoleService")
public class RuserRoleServiceImpl implements RuserRoleService {
    @Resource
    private RuserRoleDao ruserRoleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public RuserRole queryById(Integer id) {
        return this.ruserRoleDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<RuserRole> queryAllByLimit(int offset, int limit) {
        return this.ruserRoleDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ruserRole 实例对象
     * @return 实例对象
     */
    @Override
    public RuserRole insert(RuserRole ruserRole) {
        this.ruserRoleDao.insert(ruserRole);
        return ruserRole;
    }

    /**
     * 修改数据
     *
     * @param ruserRole 实例对象
     * @return 实例对象
     */
    @Override
    public RuserRole update(RuserRole ruserRole) {
        this.ruserRoleDao.update(ruserRole);
        return this.queryById(ruserRole.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.ruserRoleDao.deleteById(id) > 0;
    }

    @Override
    public List<String> querybyuid(int uid) {
        return this.ruserRoleDao.querybyuid(uid);
    }
}